#include <iostream>
#include "extract-dataset/bin_io.hpp"

using namespace std;
using namespace NIPSCompetition;

int main(int argc, char **argv) {
    char *basic_filename = "/home/zhengbian/nips-competition/data/sift1M";
    char base_filename[256];
    char query_filename[256];
    char gnd_filename[256];

    sprintf(base_filename, "%s/base.bbin", basic_filename);
    sprintf(query_filename, "%s/query.bbin", basic_filename);
    sprintf(gnd_filename, "%s/gnd.ibin", basic_filename);

    printf("%s\n%s\n%s\n", base_filename, query_filename, gnd_filename);

    unsigned int n_base, vec_dim, n_query, gnd_k;
    unsigned char *base = loadBin<unsigned char>(base_filename, n_base, vec_dim);
    unsigned char *query = loadBin<unsigned char>(query_filename, n_query, vec_dim);
    unsigned int *gnd = loadBin<unsigned int>(gnd_filename, n_query, gnd_k);
    printf("%d\n", sizeof(unsigned char));

    unsigned int n_data, dim;
    float *data = loadBin<float>(read_filename, n_data, dim, extract_len);
    printf("n_data %d, dim %d\n", n_data, dim);
    saveBin<float>(save_filename, data, n_data, dim);
    printf("save success\n");
    return 0;
}